
from socket import *

# import socket#需要使用模块名--命名空间

local_ip='127.0.0.1'
local_port=8889

class TcpSocket:
    def __init__(self,ip=local_ip,port=local_port):
        #在构造函数中定义成员变量
        _ip=ip
        _port=port
        self.__CreateSocket()
        self.__BindSocket()
        self.__ListenSocket()

    def __CreateSocket(self):
        self.listenSocket=socket(AF_INET,SOCK_STREAM)#创建套接字

    def __BindSocket(self):
        self.listenSocket.bind((local_ip,local_port))#绑定套接字和地址

    def __ListenSocket(self):
        self.listenSocket.listen()#监听套接字

    def AcceptSocket(self):
        newSocket,addr=self.listenSocket.accept()#获取一个新套接字
        return newSocket,addr


mySocket=TcpSocket()

#访问权限
## 私有:__方法名
## 保护:_方法名

class node:
    def _init__(self):#空构造
        self.x=""
        print("我是构造")
        pass
    def _debug(self):
        return self.x

var=node()
var._init__()
if not var._debug():
    print("空",end="")



